package main

import (
	"fmt"
	"strings"
)

func lengthOfLastWord(s string) int {
	slice := strings.Split(strings.Trim(s, " "), " ")
	if len(slice) > 0 {
		return len(slice[len(slice)-1])
	} else {
		return 0
	}
}

func main() {
	fmt.Println(lengthOfLastWord("hello world "))
}
